<?php

namespace app\common\model;

use app\common\controller\Random;
use think\Model;

class Business extends Model
{
    protected $name = 'business';
    /**
     * 数据完成
     * @var array
     */
    protected $auto = [];
    protected $insert = ['status' => 1, 'create_time', 'update_time', 'salt'];
    protected $update = ['update_time'];

    protected function setCreateTimeAttr()
    {
        return time();
    }

    protected function setUpdateTimeAttr()
    {
        return time();
    }

    protected function setSaltAttr($value)
    {
        return Random::alnum();
    }

    public function makePassword($password, $salt = '')
    {
        return md5(md5($password) . $salt);
    }
}